﻿using System.Collections;
using UnityEngine;
using System.IO;



public class GlobalVariables : MonoBehaviour {
    public static GameObject[] buildingObjectList;
    public static string[] buildingNameList;
    public static int numberOfBuildings;
    public GameObject[] objectList;
    public string[] nameList;

    public int[,] ruleList;

    public int numOfBuildings;
    public string filePlace;



    
	// Use this for initialization
    void Start()
    {


        buildingObjectList = new GameObject[objectList.Length];
        for (int i = 1; i < objectList.Length; i++)
        {
            buildingObjectList[i] = objectList[i];

        }
        buildingNameList = new string[nameList.Length];
        for (int i = 0; i < nameList.Length; i++)
        {
            buildingNameList[i] = nameList[i];
        }

        numberOfBuildings = numOfBuildings;


        read2DCVS();


    }

    // Update is called once per frame
    void Update()
    {
	
	}


    void read2DCVS()
    {
        StreamReader sr = new StreamReader(filePlace);
       
        int Row = 0;
        while (!sr.EndOfStream)
        {
            string myString = "";
            string[] Line = sr.ReadLine().Split(',');
            if (Row == 0)
            {
                ruleList = new int[Line.Length, Line.Length];
            }

            else
            {
                
                for (int column = 1; column < Line.Length; column++)
                {
                    myString = myString + Line[column] + ", ";
                    ruleList[Row, column] = int.Parse(Line[column]);
                }
            }   
                
                //print(myString);
            Row++;
            
        }
    }
}
